#pragma once
#ifndef NES_H
#define NES_H

////////////////////////////////////////////////////////////////////////////////////////////////////

#include <iostream>
#include "M6502.h"
#include "PPU.h"
#include <SDL.h>
#include "Joypad.h"

////////////////////////////////////////////////////////////////////////////////////////////////////

class NES {
    public:
        static NES*         GetInstance         ();
        virtual             ~NES                ();
        unsigned char       ReadMemory          ( unsigned short )const;
        void                WriteMemory         ( unsigned short, unsigned char );
        void                LoadCart            ( const std::string & );
        void                Start               ();

    private:
                            NES                 ();
        void                LaunchGraphics      ();
        void                Render              ( unsigned long* );

        static NES*         m_Instance;
        unsigned char*      m_RAM;
        unsigned char*      m_VRAM;
        unsigned char*      m_SRAM;
        M6502*              m_6502;
        PPU*                m_PPU;
        Joypad*             m_Joypad_1;
        bool                m_Running;
        SDL_Surface*        m_Screen;
};

////////////////////////////////////////////////////////////////////////////////////////////////////

#endif

////////////////////////////////////////////////////////////////////////////////////////////////////
